package com.itheima.principles.test;

public class User {

    private String name;
    private String sex;
    private Ticket ticket;

    public User(String name, String sex) {
        this.name = name;
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public void sellTicket(Ticket ticket){
        if(ticket.state==true){
            this.ticket=ticket;
            System.out.println("购买成功！");
        }else {
            System.out.println("您购买的票还未开放，无法购买！");
        }
    }
}
